async function fetchApi(url, params = {}) {
    const response = await fetch(url, {
        method: params.method || 'GET',
        headers: {
            'Content-Type': 'application/json'
        },
        ...params
    });
    if (!response.ok) {
        throw new Error(`HTTP error! status: ${response.status}`);
    }
    return await response.json();
}

export { fetchApi };